# 7.2 EhCachePlugin Configuration

The EhCachePlugin exists as a plugin within the JFinal framework. Therefore, to use it, you need to configure it in your JFinalConfig class. Below is an example code snippet for configuring the EhCachePlugin:

public class DemoConfig extends JFinalConfig {
  public void configPlugin(Plugins me) {
    me.add(new EhCachePlugin());
  }
}
1
2
3
4
5

In the DemoConfig class, which extends JFinalConfig, the EhCachePlugin is added to the list of plugins during the configuration phase. Specifically, within the configPlugin method, me.add(new EhCachePlugin()); adds a new instance of EhCachePlugin to JFinal's plugin system.

This simple configuration sets up EhCache as your caching solution, enabling you to leverage EhCache features in your JFinal application effortlessly.

Last Updated: 9/22/2023, 5:04:24 AM